package com.stream.topic;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.function.StreamBridge;
import org.springframework.stereotype.Component;

/**
 * <p>
 *
 * </p>
 *
 * @author gzj
 * @since 2022/10/10
 */
@Component
public class Producter {

    @Autowired
    StreamBridge streamBridge;
//
//    public void send(String message) {
////        streamBridge.send("testTopic-in-0", message);
//        streamBridge.send("testTopic-in-0",  MessageBuilder
//                .withPayload(message).setHeader("fooKey", "fooValue").setHeader("barKey", "barValue").build());
//        System.out.println("************发送了message："+message);
//    }


//    public void send1(String message) {
//        streamBridge.send("output", message);
//        System.out.println("************发送了message："+message);
//    }

    public void send(String message) {
        streamBridge.send("output", message);
        System.out.println("************发送了message："+message);
    }
}
